package cn.wqk.rrtf.service;

import cn.wqk.rrtf.mapper.CommentMapper;
import cn.wqk.rrtf.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentServiceImpl implements CommentService{
    @Autowired
    CommentMapper commentMapper;
    @Override
    public int addComment(Comment comment) {
        commentMapper.insertComment(comment);
        Integer commentId=comment.getCommentId();
        return commentId;
    }

    @Override
    public List<Comment> searchCommentByAId(Integer articleId) {
        Comment comment=new Comment();
        comment.setArticleId(articleId);
        return commentMapper.selectCommentByCondition(comment);
    }
}
